/**
 * @name: ResponseMessage
 * @author: XU>.<CHEN
 * @date: 2022-05-30 16:31
 * @description：请求返回体封装
 * @update: 2022-05-30 16:31
 */

class ResponseMessage {
  code: string
  message: string
  data: any

  constructor() {
    this.code = ''
    this.message = ''
    this.data = {}
  }

  success(data: any = '') {
    return {
      code: 'success',
      message: '请求成功',
      data: data
    }
  }

  error(msg: string) {
    return {
      code: 'error',
      message: msg || '服务器异常',
      data: {}
    }
  }
}

export default ResponseMessage


